﻿using System;
using System.Drawing;
using System.Windows.Forms;
using ToolUtil;

namespace zyui
{
    public partial class FrmPyxz : Form
    {
        public string[] arry;
        public string hz;
        public string str;
        public string nt="";
        public FrmPyxz()
        {
            InitializeComponent();
        }

        private void FrmPyxz_Load(object sender, EventArgs e)
        {
            if(!string.IsNullOrEmpty(nt))
                this.Text += " " + nt.Replace(hz.Trim(), "【" + hz.Trim() + "】");
            else
                this.Text += " " + hz.Trim();
            this.panel1.Controls.Clear();
            int w = 40;
            for (int i = 0; i < arry.Length; i++)
            {
                RadioButton c = new RadioButton();
                c.Name = "chaeck" + i;
                c.Text = arry[i];
                c.Location = new Point(w, 25);
                c.TabIndex = i+3;
                c.Size = new Size(StringUtil.CharWidth(arry[i])+30, 24);
                if (i == 0)
                {
                    c.Checked = true;
                }
                w += c.Width;
                this.panel1.Controls.Add(c);
            }
        }
        private void MarcRadio()
        {
            foreach (Control c in panel1.Controls)
            {
                if (c is RadioButton)
                {
                    if (((RadioButton)c).Checked)
                    {
                        str = ((RadioButton)c).Text.Trim();
                    }
                }
            }
        }
        private void savebtn_Click(object sender, EventArgs e)
        {
            this.MarcRadio();
            //Console.WriteLine("123:" + str);
            DialogResult = DialogResult.OK;
            base.Close();
        }
    }
}
